package com.proxy.parser.visitor;

import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetNamesStatement;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor;
import com.proxy.parser.ParsedResult;
import com.proxy.parser.result.SetNamesResult;
import com.proxy.parser.PoxyVisitor;

/**
 * Created by liufish on 16/12/27.
 */
public class SetNamesVisitor extends MySqlSchemaStatVisitor implements PoxyVisitor {

    private SetNamesResult setNamesResult;

    public SetNamesVisitor(ParsedResult parsedResult){

        this.setNamesResult = (SetNamesResult)parsedResult;
    }


    @Override
    public boolean visit(MySqlSetNamesStatement x) {
        boolean superValue = super.visit(x);
        return superValue;
    }

    @Override
    public void endVisit(MySqlSetNamesStatement x) {
        setNamesResult.setCharSet(x.getCharSet());
    }


}
